<!--
 * @Author: LBH 1336709799@qq.com
 * @Date: 2024-11-13 21:36:22
 * @LastEditors: LBH 1336709799@qq.com
 * @LastEditTime: 2024-11-14 11:22:19
 * @FilePath: \数学题\math\src\App.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div id="app">
    <h2>测试题</h2>
     <SubjectItem @getSum = "getSum"></SubjectItem>
    <div>
     <FlagItem :ResArr = "ResArr"></FlagItem>
    </div>
  </div>
</template>

<script>
import FlagItem from './components/FlagItem.vue';
import SubjectItem from './components/SubjectItem.vue';
export default {
  data(){
    return{
      ResArr:['未完成','未完成','未完成','未完成','未完成']
    } 
  },
  components:{
    FlagItem,
    SubjectItem
  },
  methods:{
    getSum(res1,res2,index){
      console.log(res1)
      if(res1 === res2){
        // this.ResArr.splice(index,1,{
        //   cont:'回答正确',
        //   ROW:"right"
        // }).
        this.ResArr.splice(index,1,'回答正确')
      }else if(res1 !== res2){
        if(res2 === undefined){
          // this.ResArr.splice(index,1,{
          //   cont:'未完成',
          //   ROW:'undo'
          // })
          this.ResArr.splice(index,1,'未完成')
        }else{
          // this.ResArr.splice(index,1,{
          //   cont:'回答错误',
          //   ROW:'error'
          // })
          this.ResArr.splice(index,1,'回答错误')
        }
      }
    }
  }
};
</script>

<style>
body {
  background-color: #eee;
}

#app {
  background-color: #fff;
  width: 500px;
  margin: 50px auto;
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
  padding: 2em;
}
</style>